/** @file  get_num.c
 *  @brief Get the number
 * 
 *  To get the number from the user
 *   
 *  @author Karthik M 
 *  @bug No  bugs.
 */


#include "header.h"

int get_num (char *line)
{

read_input:												//! do untill get valid number 
   if (fgets (line, LINEMAX,stdin) == NULL)
      exit (2);

   line [strlen (line) - 1] = '\0';					//! remove new line append null 

   if (valid_no (line) == 0){							//! check number is valid 
      printf ("enter the valid NUMBER!!!!!!!!\n");
      goto read_input;
   }
   return atoi(line);								//! return the number on success 

}
